package com.example.lanouhn.firstapp.activity.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.lanouhn.firstapp.R;

//个人中心的帮助中心页面
public class HelpActivity extends AppCompatActivity {

    //弹出标题栏
    private LinearLayout ll_title;
    private ImageView iv_help;
    private boolean isImageView = true;


    //隐藏标题栏跳转
    private RelativeLayout rl_homePage;
    private RelativeLayout rl_classify;
    private RelativeLayout rl_shoppingCart;
    private RelativeLayout rl_myStore;



    //返回
    private ImageView iv_back;
    //忘了密码
    private TextView forgetPassword;
    //注册会员
    private TextView tv_registerMembers;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_help);


        //找到控件
        initView();
        //监听事件
        initEvent();
    }

    private void initEvent() {
        //弹出标题栏监听事件
        iv_help.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (isImageView) {
                    ll_title.setVisibility(View.VISIBLE);
                    isImageView = false;
                } else {
                    ll_title.setVisibility(View.GONE);
                    isImageView = true;

                }
            }
        });

        //标题栏首页按钮监听事件
        rl_homePage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(HelpActivity.this,MainActivity.class);
                intent.putExtra("symbol",1);
                startActivity(intent);
            }
        });
        //标题栏分类按钮监听事件
        rl_classify.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(HelpActivity.this,MainActivity.class);
                intent.putExtra("symbol",2);
                startActivity(intent);
            }
        });
        //标题栏购物车按钮监听事件
        rl_shoppingCart.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(HelpActivity.this,MainActivity.class);
                intent.putExtra("symbol",3);
                startActivity(intent);
            }
        });
        //标题栏我的商城按钮监听事件
        rl_myStore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(HelpActivity.this,MainActivity.class);
                intent.putExtra("symbol",4);
                startActivity(intent);
            }
        });


        //返回--点击事件
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                setResult(123,intent);
                finish();
            }
        });
        //忘记密码--点击事件
        forgetPassword.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(HelpActivity.this, ForgetPasswordActivity.class);
                startActivity(intent);
            }
        });


        tv_registerMembers.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(HelpActivity.this, RegisterMembersActivity.class);
                startActivity(intent);
            }
        });

    }

    private void initView() {

        rl_homePage = (RelativeLayout) findViewById(R.id.rl_homePage);
        rl_classify = (RelativeLayout) findViewById(R.id.rl_classify);
        rl_shoppingCart = (RelativeLayout) findViewById(R.id.rl_shoppingCart);
        rl_myStore = (RelativeLayout) findViewById(R.id.rl_myStore);

        ll_title = (LinearLayout) findViewById(R.id.ll_title);
        iv_help = (ImageView) findViewById(R.id.iv_help);



        iv_back = (ImageView) findViewById(R.id.iv_back);
        forgetPassword = (TextView) findViewById(R.id.forgetPassword);
        tv_registerMembers = (TextView) findViewById(R.id.tv_registerMembers);


    }
}
